<template>
  <div>
    <div style="padding: 5px 10px">
      <table class="bs-table">
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">标题</th>
          <td class="bs-table_td" colspan="3">
            <span style="vertical-align: bottom">{{detaildata.title}}</span>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">报送文件</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <div v-for="fileid in detaildata.reportFileIds" :key="fileid">
                <preview :attachementId="fileid" v-if="fileid"></preview>
              </div>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">拟发布范围</th>
          <td class="bs-table_td" colspan="3">
            <el-link style="font-weight: bold;font-size: 20px"  target="_blank">
              {{detaildata.openScope}}
            </el-link>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">编制说明</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <preview :attachementId="detaildata.instruction" v-if="detaildata.instruction"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划文本</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <preview :attachementId="detaildata.txt" v-if="detaildata.txt"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">衔接意见</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <preview :attachementId="detaildata.connectOpinion" v-if="detaildata.connectOpinion"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">专家评审意见</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <preview :attachementId="detaildata.expertOpinion" v-if="detaildata.expertOpinion"></preview>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">其他附件</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <div v-for="fileid in detaildata.otherFileIds" :key="fileid">
                <preview :attachementId="fileid" v-if="fileid"></preview>
              </div>
            </div>
          </td>
        </tr>
        <tr class="bs-table_row">
          <th class="bs-table_th" style="width: 200px">规划文本（部分公开）</th>
          <td class="bs-table_td" colspan="3">
            <div v-if="show">
              <preview :attachementId="detaildata.txtHalfOpen" v-if="detaildata.txtHalfOpen"></preview>
            </div>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
  import {reviewDetail} from "@/api/review";
  import {REVIEW_DIC} from '@/const/dict'
  import {getNotNull, getFileTypeFiles, getFileTypeFile} from '@/views/util'

  export default {
    name: "examineDetail",
    props: {
      id: Number
    },
    created() {
      this.getDetailData_review(this.id);
    },
//    computed: {},
    data() {
      return {
        detaildata: {
          reportFileIds: null,
          instruction: null,
          txt: null,
          openScope: null,
          connectOpinion: null,
          expertOpinion: null,
          otherFileIds: null,
          txtHalfOpen: null,
        },
        show: false

      }
    },
    methods: {
      async getDetailData_review(id) {
        reviewDetail(id).then(response => {
          this.detaildata.title = response.data.data.title;
          this.detaildata.reportFileIds = response.data.data.reportFileIds;
          this.detaildata.instruction = response.data.data.instruction;
          this.detaildata.txt = response.data.data.txt;
          this.detaildata.openScope = getNotNull(response.data.data.openScope, REVIEW_DIC.publishDIC);
          this.detaildata.connectOpinion = response.data.data.connectOpinion;
          this.detaildata.expertOpinion = response.data.data.expertOpinion;
          this.detaildata.otherFileIds = response.data.data.otherFileIds;
          this.detaildata.txtHalfOpen = response.data.data.txtHalfOpen;
          this.show = true
        })
      },
    }
  }
</script>

<style ang="scss" scoped>

</style>
